# ruff: noqa: E501
from opendbc.car.structs import CarParams
from opendbc.car.byd.values import CAR

Ecu = CarParams.Ecu

# Todo: could fingerprints for song dmi be able to combine?
FINGERPRINTS = {
  CAR.BYD_HAN_DM_20: [{
    85: 8, 140: 8, 213: 8, 269: 8, 287: 5, 289: 8, 290: 8, 291: 8, 301: 8, 303: 8, 307: 8, 309: 8, 315: 8, 384: 8, 496: 8, 530: 8, 536: 8, 544: 8, 546: 8, 547: 8, 576: 8, 578: 8, 588: 8, 660: 8, 694: 8, 790: 8, 792: 8, 797: 8, 798: 8, 801: 8, 802: 8, 813: 8, 814: 8, 815: 8, 833: 8, 834: 8, 836: 8, 843: 8, 860: 8, 884: 8, 916: 8, 918: 8, 926: 8, 940: 8, 941: 8, 944: 8, 948: 8, 985: 8, 988: 8, 1004: 8, 1020: 8, 1037: 8, 1040: 8, 1058: 8, 1074: 8, 1141: 8, 1172: 8, 1178: 8, 1180: 8, 1193: 8, 1246: 8, 1293: 8, 1793: 8, 1796: 8, 1804: 8, 1904: 8, 1905: 8, 1912: 8, 1913: 8, 1986: 8, 2004: 8, 2034: 8, 2042: 8
  }],
  CAR.BYD_HAN_EV_20: [{
    85: 8, 140: 8, 213: 8, 287: 5, 289: 8, 290: 8, 291: 8, 301: 8, 303: 8, 307: 8, 308: 8, 309: 8, 315: 8, 464: 8, 465: 8, 480: 8, 496: 8, 536: 8, 544: 8, 546: 8, 547: 8, 576: 8, 578: 8, 588: 8, 660: 8, 694: 8, 790: 8, 792: 8, 797: 8, 798: 8, 801: 8, 802: 8, 812: 8, 813: 8, 814: 8, 815: 8, 833: 8, 834: 8, 836: 8, 843: 8, 860: 8, 863: 8, 879: 8, 884: 8, 916: 8, 918: 8, 920: 8, 926: 8, 940: 8, 941: 8, 944: 8, 948: 8, 965: 8, 976: 8, 985: 8, 988: 8, 1004: 8, 1020: 8, 1036: 8, 1037: 8, 1040: 8, 1048: 8, 1058: 8, 1074: 8, 1141: 8, 1172: 8, 1178: 8, 1180: 8, 1193: 8, 1246: 8, 1268: 8, 1793: 8, 1794: 8, 1797: 8, 1798: 8, 1801: 8, 1808: 8, 1809: 8, 1811: 8, 1812: 8, 1824: 8, 1827: 8, 1828: 8, 1829: 8, 1830: 8, 1842: 8, 1843: 8, 1845: 8, 1847: 8, 1858: 8, 1859: 8, 1862: 8, 1863: 8, 1872: 8, 1873: 8, 1874: 8, 1876: 8, 1890: 8, 1891: 8, 1894: 8, 1904: 8, 1905: 8, 1912: 8, 1913: 8, 1920: 8, 1921: 8, 1922: 8, 1923: 8, 1925: 8, 1927: 8, 1939: 8, 1940: 8, 1943: 8, 1959: 8, 1971: 8, 1973: 8, 1984: 8, 1986: 8, 1987: 8, 1991: 8, 1994: 8, 2002: 8, 2004: 8, 2006: 8, 2012: 8, 2033: 8, 2034: 8, 2042: 8
  }],
  CAR.BYD_TANG_DM: [{
    85: 8, 140: 8, 256: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 301: 8, 307: 8, 315: 8, 464: 8, 496: 8, 522: 8, 523: 8, 527: 8, 530: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 576: 8, 577: 8, 578: 8, 588: 8, 593: 8, 596: 8, 636: 8, 660: 8, 694: 8, 769: 8, 770: 8, 784: 8, 788: 8, 790: 8, 792: 8, 800: 8, 801: 8, 802: 8, 813: 8, 814: 8, 815: 8, 832: 8, 833: 8, 834: 8, 835: 8, 836: 8, 838: 8, 839: 8, 841: 8, 842: 8, 848: 8, 849: 8, 850: 8, 851: 8, 852: 8, 854: 8, 860: 8, 896: 8, 897: 8, 898: 8, 899: 8, 900: 8, 901: 8, 902: 8, 903: 8, 904: 8, 905: 8, 906: 8, 907: 8, 908: 8, 909: 8, 910: 8, 911: 8, 912: 8, 913: 8, 914: 8, 915: 8, 916: 8, 917: 8, 918: 8, 919: 8, 926: 8, 944: 8, 948: 8, 968: 8, 969: 8, 970: 8, 971: 8, 972: 8, 973: 8, 974: 8, 975: 8, 976: 8, 977: 8, 978: 8, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 985: 8, 986: 8, 987: 8, 988: 8, 989: 8, 990: 8, 991: 8, 992: 8, 993: 8, 994: 8, 995: 8, 996: 8, 997: 8, 998: 8, 999: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1004: 8, 1005: 8, 1006: 8, 1007: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1016: 8, 1017: 8, 1018: 8, 1019: 8, 1020: 8, 1021: 8, 1022: 8, 1023: 8, 1037: 8, 1040: 8, 1058: 8, 1074: 8, 1104: 8, 1141: 8, 1172: 8, 1178: 8, 1181: 8, 1193: 8, 1219: 8, 1224: 8, 1246: 8, 1385: 8, 1809: 8, 1817: 8, 1840: 8, 1848: 8, 1872: 8, 1873: 8, 1874: 8, 1875: 8, 1876: 8, 1877: 8, 1878: 8, 1879: 8, 1880: 8, 1881: 8, 1882: 8, 1883: 8, 1884: 8, 1885: 8, 1886: 8, 1887: 8, 1906: 8, 1914: 8, 1973: 8, 1974: 8, 1975: 8, 1981: 8, 1982: 8, 1983: 8, 1991: 8, 2006: 8, 2017: 8, 2025: 8, 2032: 8, 2040: 8, 134117888: 8
  }],
  CAR.BYD_TANG_DMI_21: [{
    85: 8, 140: 8, 213: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 300: 8, 301: 8, 307: 8, 309: 8, 337: 8, 356: 8, 371: 8, 384: 8, 418: 8, 450: 8, 496: 8, 522: 8, 525: 8, 527: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 575: 8, 576: 8, 577: 8, 578: 8, 587: 8, 588: 8, 593: 8, 629: 8, 635: 8, 638: 8, 660: 8, 665: 8, 681: 8, 694: 8, 703: 8, 724: 8, 733: 8, 748: 8, 775: 8, 777: 8, 781: 8, 790: 8, 792: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 812: 8, 813: 8, 814: 8, 815: 8, 827: 8, 828: 8, 829: 8, 833: 8, 834: 8, 835: 8, 836: 8, 843: 8, 847: 8, 854: 8, 860: 8, 863: 8, 878: 8, 879: 8, 884: 8, 906: 8, 940: 8, 941: 8, 944: 8, 948: 8, 951: 8, 965: 8, 973: 8, 985: 8, 1004: 8, 1023: 8, 1028: 8, 1031: 8, 1036: 8, 1037: 8, 1038: 8, 1040: 8, 1048: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1097: 8, 1098: 8, 1141: 8, 1163: 8, 1178: 8, 1189: 8, 1193: 8, 1215: 8, 1246: 8, 1263: 8, 1273: 8, 1274: 8, 1297: 8, 1298: 8, 1337: 8, 1338: 8, 1609: 8, 1613: 8, 1649: 8, 1792: 8, 1793: 8, 1798: 8, 1799: 8, 1810: 8, 1813: 8, 1824: 8, 1825: 8, 1832: 8, 1840: 8, 1842: 8, 1856: 8, 1858: 8, 1859: 8, 1860: 8, 1862: 8, 1863: 8, 1864: 8, 1871: 8, 1872: 8, 1875: 8, 1879: 8, 1882: 8, 1888: 8, 1889: 8, 1892: 8, 1902: 8, 1912: 8, 1913: 8, 1920: 8, 1927: 8, 1937: 8, 1948: 8, 1953: 8, 1954: 8, 1955: 8, 1968: 8, 1969: 8, 1971: 8, 1975: 8, 1976: 8, 1979: 8, 1988: 8, 1990: 8, 2000: 8, 2001: 8, 2004: 8, 2009: 8, 2012: 8, 2017: 8, 2018: 8, 2020: 8, 2026: 8, 2027: 8, 2030: 8, 2033: 8, 2041: 8
  }],
  CAR.BYD_SONG_PLUS_DMI_21: [{
    85: 8, 140: 8, 213: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 301: 8, 307: 8, 337: 8, 356: 8, 371: 8, 418: 8, 450: 8, 496: 8, 522: 8, 525: 8, 527: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 575: 8, 576: 8, 577: 8, 578: 8, 588: 8, 593: 8, 629: 8, 638: 8, 660: 8, 694: 8, 724: 8, 748: 8, 781: 8, 786: 8, 790: 8, 792: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 812: 8, 813: 8, 814: 8, 815: 8, 827: 8, 828: 8, 829: 8, 833: 8, 834: 8, 835: 8, 836: 8, 847: 8, 854: 8, 860: 8, 863: 8, 878: 8, 879: 8, 906: 8, 940: 8, 941: 8, 944: 8, 951: 8, 965: 8, 973: 8, 985: 8, 1004: 8, 1020: 8, 1023: 8, 1028: 8, 1031: 8, 1037: 8, 1038: 8, 1040: 8, 1048: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1097: 8, 1098: 8, 1141: 8, 1178: 8, 1189: 8, 1193: 8, 1215: 8, 1246: 8, 1273: 8, 1274: 8, 1278: 8, 1297: 8, 1298: 8, 1319: 8, 1322: 8, 1337: 8, 1338: 8, 1687: 8}, {85: 8, 140: 8, 213: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 300: 8, 301: 8, 307: 8, 309: 8, 337: 8, 356: 8, 371: 8, 427: 8, 450: 8, 496: 8, 522: 8, 525: 8, 527: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 575: 8, 576: 8, 577: 8, 578: 8, 588: 8, 593: 8, 629: 8, 638: 8, 660: 8, 681: 8, 694: 8, 703: 8, 724: 8, 748: 8, 781: 8, 786: 8, 790: 8, 792: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 812: 8, 813: 8, 814: 8, 815: 8, 827: 8, 828: 8, 829: 8, 833: 8, 834: 8, 835: 8, 836: 8, 847: 8, 854: 8, 860: 8, 863: 8, 878: 8, 879: 8, 906: 8, 940: 8, 941: 8, 944: 8, 951: 8, 973: 8, 985: 8, 1004: 8, 1020: 8, 1023: 8, 1028: 8, 1031: 8, 1037: 8, 1038: 8, 1040: 8, 1048: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1097: 8, 1098: 8, 1141: 8, 1163: 8, 1178: 8, 1189: 8, 1193: 8, 1215: 8, 1246: 8, 1273: 8, 1274: 8, 1297: 8, 1298: 8, 1319: 8, 1322: 8, 1337: 8, 1338: 8
  }],
  CAR.BYD_SONG_PLUS_DMI_22: [{
    85: 8, 140: 8, 213: 8, 256: 8, 257: 8, 258: 8, 259: 8, 260: 8, 261: 8, 262: 8, 263: 8, 264: 8, 265: 8, 266: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 300: 8, 301: 8, 307: 8, 309: 8, 337: 8, 356: 8, 371: 8, 418: 8, 450: 8, 496: 8, 522: 8, 525: 8, 527: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 575: 8, 576: 8, 577: 8, 578: 8, 588: 8, 593: 8, 629: 8, 635: 8, 638: 8, 660: 8, 681: 8, 694: 8, 703: 8, 724: 8, 733: 8, 748: 8, 769: 8, 770: 8, 781: 8, 786: 8, 790: 8, 792: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 812: 8, 813: 8, 814: 8, 815: 8, 827: 8, 828: 8, 829: 8, 832: 8, 833: 8, 834: 8, 835: 8, 836: 8, 838: 8, 839: 8, 841: 8, 842: 8, 847: 8, 848: 8, 849: 8, 850: 8, 851: 8, 852: 8, 854: 8, 860: 8, 863: 8, 878: 8, 879: 8, 896: 8, 897: 8, 898: 8, 899: 8, 900: 8, 901: 8, 902: 8, 903: 8, 904: 8, 905: 8, 906: 8, 907: 8, 908: 8, 909: 8, 910: 8, 911: 8, 912: 8, 913: 8, 914: 8, 915: 8, 916: 8, 917: 8, 918: 8, 919: 8, 940: 8, 941: 8, 944: 8, 951: 8, 965: 8, 968: 8, 969: 8, 970: 8, 971: 8, 972: 8, 973: 8, 974: 8, 975: 8, 976: 8, 977: 8, 978: 8, 979: 8, 980: 8, 981: 8, 982: 8, 983: 8, 984: 8, 985: 8, 986: 8, 987: 8, 988: 8, 989: 8, 990: 8, 991: 8, 992: 8, 993: 8, 994: 8, 995: 8, 996: 8, 997: 8, 998: 8, 999: 8, 1000: 8, 1001: 8, 1002: 8, 1003: 8, 1004: 8, 1005: 8, 1006: 8, 1007: 8, 1008: 8, 1009: 8, 1010: 8, 1011: 8, 1012: 8, 1013: 8, 1014: 8, 1015: 8, 1016: 8, 1017: 8, 1018: 8, 1019: 8, 1020: 8, 1021: 8, 1022: 8, 1023: 8, 1028: 8, 1031: 8, 1037: 8, 1038: 8, 1040: 8, 1048: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1097: 8, 1098: 8, 1141: 8, 1163: 8, 1178: 8, 1189: 8, 1193: 8, 1215: 8, 1246: 8, 1273: 8, 1274: 8, 1278: 8, 1297: 8, 1298: 8, 1337: 8, 1338: 8, 1385: 8
  }],
  CAR.BYD_SONG_PLUS_DMI_23: [{
    85: 8, 140: 8, 213: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 300: 8, 301: 8, 307: 8, 337: 8, 352: 8, 353: 8, 356: 8, 357: 8, 360: 8, 361: 8, 364: 8, 368: 8, 369: 8, 370: 8, 371: 8, 372: 8, 373: 8, 374: 8, 376: 8, 377: 8, 378: 8, 380: 8, 381: 8, 382: 8, 384: 8, 385: 8, 386: 8, 388: 8, 389: 8, 390: 8, 392: 8, 393: 8, 394: 8, 396: 8, 397: 8, 398: 8, 400: 8, 401: 8, 402: 8, 404: 8, 405: 8, 406: 8, 408: 8, 409: 8, 410: 8, 412: 8, 413: 8, 414: 8, 416: 8, 417: 8, 418: 8, 420: 8, 421: 8, 422: 8, 424: 8, 425: 8, 426: 8, 427: 8, 428: 8, 429: 8, 430: 8, 432: 8, 433: 8, 434: 8, 436: 8, 437: 8, 438: 8, 440: 8, 441: 8, 442: 8, 444: 8, 445: 8, 446: 8, 448: 8, 449: 8, 450: 8, 452: 8, 453: 8, 454: 8, 456: 8, 457: 8, 458: 8, 460: 8, 461: 8, 462: 8, 464: 8, 465: 8, 466: 8, 468: 8, 469: 8, 470: 8, 472: 8, 473: 8, 474: 8, 476: 8, 477: 8, 478: 8, 480: 8, 481: 8, 483: 8, 484: 8, 485: 8, 486: 8, 488: 8, 489: 8, 490: 8, 492: 8, 493: 8, 494: 8, 496: 8, 522: 8, 525: 8, 527: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 575: 8, 576: 8, 577: 8, 578: 8, 588: 8, 593: 8, 629: 8, 660: 8, 681: 8, 694: 8, 703: 8, 724: 8, 748: 8, 781: 8, 786: 8, 790: 8, 792: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 812: 8, 813: 8, 814: 8, 815: 8, 833: 8, 834: 8, 835: 8, 836: 8, 843: 8, 847: 8, 854: 8, 860: 8, 863: 8, 878: 8, 879: 8, 884: 8, 906: 8, 940: 8, 941: 8, 944: 8, 951: 8, 965: 8, 973: 8, 985: 8, 1004: 8, 1020: 8, 1023: 8, 1028: 8, 1031: 8, 1037: 8, 1038: 8, 1040: 8, 1048: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1097: 8, 1098: 8, 1141: 8, 1163: 8, 1169: 8, 1178: 8, 1189: 8, 1193: 8, 1215: 8, 1246: 8, 1273: 8, 1274: 8, 1278: 8, 1297: 8, 1298: 8, 1337: 8, 1338: 8
  }],
  CAR.BYD_SONG_PRO_DMI_22: [{
    85: 8, 140: 8, 213: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 300: 8, 301: 8, 307: 8, 337: 8, 356: 8, 371: 8, 418: 8, 450: 8, 496: 8, 522: 8, 525: 8, 527: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 576: 8, 577: 8, 578: 8, 588: 8, 593: 8, 629: 8, 638: 8, 660: 8, 681: 8, 694: 8, 703: 8, 724: 8, 748: 8, 781: 8, 786: 8, 790: 8, 792: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 812: 8, 813: 8, 814: 8, 815: 8, 827: 8, 828: 8, 829: 8, 833: 8, 834: 8, 835: 8, 836: 8, 843: 8, 847: 8, 854: 8, 860: 8, 863: 8, 878: 8, 879: 8, 884: 8, 906: 8, 944: 8, 951: 8, 965: 8, 973: 8, 985: 8, 1004: 8, 1020: 8, 1023: 8, 1028: 8, 1031: 8, 1037: 8, 1038: 8, 1040: 8, 1048: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1097: 8, 1098: 8, 1141: 8, 1163: 8, 1178: 8, 1189: 8, 1193: 8, 1215: 8, 1246: 8, 1273: 8, 1274: 8, 1278: 8, 1297: 8, 1298: 8
  }],
  CAR.BYD_QIN_PLUS_DMI_23: [{
    85: 8, 140: 8, 213: 8, 234: 8, 235: 8, 269: 8, 270: 8, 287: 5, 289: 8, 290: 8, 291: 8, 300: 8, 301: 8, 307: 8, 337: 8, 371: 8, 450: 8, 455: 8, 496: 8, 522: 8, 525: 8, 527: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 575: 8, 576: 8, 577: 8, 578: 8, 588: 8, 593: 8, 629: 8, 635: 8, 638: 8, 660: 8, 681: 8, 694: 8, 703: 8, 724: 8, 733: 8, 748: 8, 781: 8, 786: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 813: 8, 814: 8, 815: 8, 833: 8, 834: 8, 835: 8, 836: 8, 847: 8, 854: 8, 860: 8, 878: 8, 906: 8, 944: 8, 951: 8, 965: 8, 973: 8, 985: 8, 1004: 8, 1023: 8, 1028: 8, 1031: 8, 1037: 8, 1038: 8, 1040: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1097: 8, 1098: 8, 1141: 8, 1163: 8, 1169: 8, 1178: 8, 1189: 8, 1193: 8, 1211: 8, 1215: 8, 1226: 8, 1246: 8, 1273: 8, 1274: 8, 1278: 8, 1297: 8
  }],
  CAR.BYD_YUAN_PLUS_DMI_22: [{
    85: 8, 140: 8, 213: 8, 287: 5, 289: 8, 290: 8, 291: 8, 301: 8, 307: 8, 309: 8, 324: 8, 337: 8, 371: 8, 450: 8, 496: 8, 522: 8, 536: 8, 537: 8, 544: 8, 546: 8, 547: 8, 575: 8, 576: 8, 577: 8, 578: 8, 588: 8, 629: 8, 639: 8, 660: 8, 694: 8, 724: 8, 748: 8, 786: 8, 790: 8, 792: 8, 797: 8, 798: 8, 800: 8, 801: 8, 802: 8, 803: 8, 812: 8, 813: 8, 814: 8, 815: 8, 833: 8, 834: 8, 835: 8, 836: 8, 843: 8, 847: 8, 848: 8, 854: 8, 860: 8, 863: 8, 879: 8, 884: 8, 906: 8, 944: 8, 951: 8, 965: 8, 973: 8, 985: 8, 1004: 8, 1020: 8, 1023: 8, 1028: 8, 1031: 8, 1037: 8, 1040: 8, 1048: 8, 1052: 8, 1058: 8, 1074: 8, 1076: 8, 1098: 8, 1141: 8, 1169: 8, 1178: 8, 1184: 8, 1189: 8, 1192: 8, 1193: 8, 1211: 8, 1215: 8, 1246: 8, 1274: 8, 1278: 8, 1297: 8, 1319: 8, 1322: 8
  }],
}

#Todo: Get a byd VDS to see how fw could be queried. Currently added just for preventing ruffs error.
FW_VERSIONS = {
  CAR.BYD_HAN_DM_20: {
    (Ecu.eps, 0x700, None): [
      b'DUMMYDATA',
    ],
  },
}